<template>
	<view class="page">
		{{ text }}
	</view>
</template>

<script setup lang="ts">
	import { defineProps, computed, onMounted } from "vue"
	import type { Props } from "./types"
	
	const props = withDefaults(defineProps<Props>(), {
	  options: () => [],
	  dictValue: '',
	  labelFiled: 'dictLabel',
	  valueFiled: 'dictValue'
	})
	//回显字典文本
	let text = computed(() => {
		let target = props.dictValue
		let options = props.options
		let result = options.find(item => item[props.valueFiled] == target)
		if(result){
			return result[props.labelFiled]
		}else{
			return '--'
		}
	})
</script>

<style scoped lang="scss">
	.page{
		display: inline;
	}
</style>